home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / netz / nwfinf / nwfinf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-12  |  2.8 KB  |  130 lines

  1. // Project     : NWFINF
  2. // Description : Application to show functions for getting Netware file info
  3. // Module      : NWFINF.H
  4. // Version     : 1.00 - 11/05/1994
  5. // Written by  : David A. Mair
  6. // Copyright   : Who cares, help yourself.
  7.  
  8.  
  9. #if !defined(__NWFINF_H)
  10. #define __NWFINF_H
  11.  
  12.  
  13. #include <fcntl.h>
  14. #include <io.h>
  15. #include <iostream.h>
  16. #include <sys\stat.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20.  
  21.  
  22. // New types
  23. typedef int BOOL;
  24. typedef unsigned char BYTE;
  25. typedef unsigned short WORD;
  26. typedef unsigned long DWORD;
  27.  
  28.  
  29. struct nwDate
  30.     {
  31.     // The order of these is compiler implementation dependent
  32.     WORD dtDay : 5;
  33.     WORD dtMonth : 4;
  34.     WORD dtYear : 7;
  35.     };
  36.  
  37.  
  38. struct nwDateTime
  39.     {
  40.     // The order of these is compiler implementation dependent
  41.     WORD tiSecond : 5;
  42.     WORD tiMinute : 6;
  43.     WORD tiHour : 5;
  44.     WORD dtDay : 5;
  45.     WORD dtMonth : 4;
  46.     WORD dtYear : 7;
  47.     };
  48.  
  49.  
  50. // Note the byte order information for the non-byte sized fields in the
  51. // following structures.  In order to set a given field you must store the
  52. // value supplied by the compiler and use one of the SwapWord or SwapDWord
  53. // functions after storing the value.  To use a value in a field you must
  54. // call the appropriate Swap... function before use.
  55.  
  56. struct TFileInformation
  57.     {
  58.     WORD wBuffLen;                // Lo-Hi
  59.     WORD wSequence;                // Hi-Lo
  60.     char sFileName[14];
  61.     BYTE faReadOnly : 1;
  62.     BYTE faHidden : 1;
  63.     BYTE faSystem : 1;
  64.     BYTE faExecOnly : 1;
  65.     BYTE faSubDir : 1;
  66.     BYTE faArchive : 1;
  67.     BYTE faSharable : 1;
  68.     BYTE : 1;
  69.     BYTE byExtendedAttr;
  70.     DWORD dwFileSize;            // Hi-Lo
  71.     nwDate dtCreated;            // Hi-Lo
  72.     nwDate dtLastAccessed;        // Hi-Lo
  73.     nwDateTime dttLastUpdated;    // Hi-Lo
  74.     DWORD dwOwner;                // Hi-Lo
  75.     nwDateTime dttLastArchived;    // Hi-Lo
  76.     BYTE byReserved[56];
  77.     };
  78.  
  79.  
  80. struct TFileInfoRequest
  81.     {
  82.     WORD wBuffLen;              // Lo-Hi
  83.     BYTE byMagicNumber;
  84.     WORD wSequence;                // Hi-Lo
  85.     BYTE byDirHandle;
  86.     BYTE :1;
  87.     BYTE saHiddenFiles : 1;
  88.     BYTE saSystemFiles : 1;
  89.     BYTE : 5;
  90.     BYTE byFileNameLength;
  91.     char sFileName[256];
  92.     };
  93.  
  94.  
  95. struct TBinderyObjectInfo
  96.     {
  97.     WORD wBuffLen;              // Lo-Hi
  98.     DWORD dwID;                    // Hi-Lo
  99.     WORD wType;                    // Hi-Lo
  100.     char sName[48];
  101.     };
  102.  
  103.  
  104. struct TBinderyObjectInfoRequest
  105.     {
  106.     WORD wBuffLen;                // Lo-Hi
  107.     BYTE byMagicNumber;
  108.     DWORD dwLastID;                // Hi-Lo
  109.     };
  110.  
  111.  
  112. // Function prototypes
  113. void AboutApp(void);
  114. void DisplayFileInfo(char *pszFileName);
  115. BYTE GetFileInformation(char *pszFileName, struct TFileInformation far *tFileInfo);
  116. BOOL IsFile(char *pszFileName);
  117. int main(int argc, char *argv[]);
  118. BYTE GetBinderyObjectName(DWORD dwBinderyObjectID, TBinderyObjectInfo far *tBinderyObjectInfo);
  119. void ShowSyntax(void);
  120. void SwapDWord(DWORD far *dwToSwap);
  121. void SwapWord(WORD far *wToSwap);
  122.  
  123.  
  124. // Manifest constants
  125. #define FALSE 0
  126. #define TRUE  1
  127.  
  128.  
  129. #endif
  130.